package com.gitee.wsl.ext.list


/**
 * Returns an array copy of the current contents of this [List] instance.
 *
 * **Example:**
 * ```
 * myList.toArray(::Array<String>)
 * ```
 *
 * @return An array copy of the current contents of this [List] instance.
 *
 * @since 0.3.0
 */
fun<T> List<T>.toArray(arrayProvider: (size: Int, init: (Int) -> T) -> Array<T>) = arrayProvider(size, ::get)